//---------------------------------------------------------------------------- // File: IX_Window.h [v2.3] // Type: Win32 Controller // Author: Ken Anderson // Date: 3/3/06 // OS dependant: Windows // // Notes: Contains header files, typedefs, structs & definitions specific // to windows only. // // Versions: // 1.0[2/23/03] -- Original // 2.0[2/26/06] -- Updated to remove the message management system. // 2.1[3/5/06] -- Updated to include Active functionality. // 2.2[3/6/06] -- SetWindowSize appended to the system. // 2.3[3/6/06] -- UpdateDisplay appended. // // Header file's required: // 1) OS_API_Template.h[v2.1] -- The OS API Template that the Windows Management will // be built on, like a frame/foundation that defines // functions specifically needed for any OS. If an OS // does not define a function, then the function is designed // to return NA for not supported. // 2) CiMedia.h[v1] -- Contains the CiMedia class that will manage most media // management and manipulation. // 3) -- Absolutely required to manipulate the Windows OS system. // 4) -- Management of windows universal strings(UNICODE/ANSI). // 5) -- Basic memory operations. // 6) Win32_Misc.h -- Misc functions that create a bridge between the program & // the windows operating system. //---------------------------------------------------------------------------- #if _MSC_VER > 1000 #pragma once #endif // _MSC_VER > 1000 //////////////////////////// // DEFINITIONS // //////////////////////////// //#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers //////////////////////////// // INCLUDES // //////////////////////////// //Win specific #include #include #include #include "OS_API_Template.h" #include "CiMedia.h" #include "Bitmap.h" #include "Win32_Misc.h" //////////////////////////// // STRUCTURE DEFINES // //////////////////////////// //////////////////////////// // MESSAGE DEFINITIONS // //////////////////////////// #define WM_APPEVENT (WM_USER+1) //////////////////////////// // FUNCTION DEFINES // //////////////////////////// INT WinMain_ENTRY(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, INT nCmdShow); //////////////////////////// // CLASS LAYOUT // //////////////////////////// class IX_Window : OS_API_Template { private: ////////////////////////// //--WINDOWS PROPERTIES--// ////////////////////////// LPTSTR m_lpClassName; //Name of the class. LPTSTR m_lpWindowName; //Name of the window. LPTSTR m_lpMenuName; //Name of the menu resource. DWORD m_dwStyle; //Style of window INT m_iWinX, m_iWinY; //Windows location. INT m_iWinHeight; //Window Height INT m_iWinWidth; //Window Width HWND m_hwndWinDepth; //Window Depth ////////////////////////////// //--APPLICATION PROPERTIES--// ////////////////////////////// INT m_nCmdShow; //Window Visible properties. HWND m_hwnd; //Handle of the window. HMENU m_hmenu; //Handle of the menu. HICON m_hicon; //Icon of the window. HINSTANCE m_hinst; //Instance of the program. ////////////////////////// //--MESSAGE PROPERTIES--// ////////////////////////// BOOL m_bActive; //The active state of the program. BOOL m_bIdle; //Allows idling processing. /////////////////////////// //--CALLBACK PROPERTIES--// /////////////////////////// WNDPROC m_lpfnWndProc; //Pointer to the Windows Procedure. //////////////////////// //--PAINT PROPERTIES--// //////////////////////// PAINTSTRUCT m_ps; //Paint structure required for being & end paint for windows OS. HDC m_hdc; //Handle to the DC used in the windows graphics system. BOOL m_bBD; //A boolean value that represents true if beginpaint has started. //////////////////////// //---SYSTEM BACKUPS---// //////////////////////// HWND m_hwndCapture; //Last window that had captured the mouse. public: //////////////////////// //--Class Dependants--// //////////////////////// IX_Window(HINSTANCE hinst, WNDPROC lpfnWndProc, LPTSTR ClassName=NULL, LPTSTR WindowName=NULL, INT nCmdShow=SW_SHOWNORMAL, INT iX=NULL, INT iY=NULL, INT iWidth=NULL, INT iHeight=NULL); IX_Window(const IX_Window* window); ~IX_Window(); /////////////////////////// //--Program Controllers--// /////////////////////////// OS_ERR PrintMsg(cstr pMessage); OS_ERR Create(); OS_ERR Destroy(); OS_ERR Close(); ///////////////////////// //---Cursor Controls---// ///////////////////////// OS_ERR SetCursor(cstr pzCursor); OS_ERR GetCursorPos(long* px, long* py); OS_ERR SetCursorPos(int x, int y); OS_ERR SetCapture(); OS_ERR ReleaseCapture(); ///////////////////////// //------Querries-------// ///////////////////////// void QueryOS(POSQuery qc); cstr GetOS(); //OS_ERR GetVersion(){}; //**To Implement** OS_ERR GetClientSize(POSRect rc); OS_ERR GetWindowSize(POSRect rc); ///////////////////////// //--WINDOW SIZE & LOC--// ///////////////////////// //OS_ERR Minimize(){}; //**To Implement** //OS_ERR Maximize(){}; //**To Implement** //OS_ERR Resize(){}; //**To Implement** OS_ERR SetWindowPos(int ix, int iy, int iWidth, int iHeight, OSZOrder zOrder, uint uFlag); OS_ERR SetWindowSize(int iWidth, int iHeight); OS_ERR SetWindowStyle(uint uStyle); OS_ERR SetWindowTitle(cstr strTitle); ///////////////////////// //--------Tools--------// ///////////////////////// float Timer(OSTimerState TS); //Returns and controls the system timer. /////////////////////// //--Message Handler--// /////////////////////// bool Quit(MSG_EVENT state); bool SystemManager(bool& rbIdle); //Enable & Disable Idle are features that allow a program to run //in windows bool IsIdling(){return (m_bIdle != 0);} OS_ERR EnableIdle(){m_bIdle = TRUE; return EC_OK;} OS_ERR DisableIdle(){m_bIdle = FALSE; return EC_OK;} bool IsActive(){return (m_bActive != 0);} OS_ERR EnableActive(){m_bActive = TRUE; return EC_OK;} OS_ERR DisableActive(){m_bActive = FALSE; return EC_OK;} ///////////////////// // File Management // ///////////////////// OS_ERR FileExists(cstr psFileName); OS_ERR CreateFile(void*** tvFileHandle, cstr psFileName, Dword dwAccess, Dword dwShare, Dword dwCreationMethod, Dword dwFlags); OS_ERR ReadFile(void** hvFile, void* pvBuffer, Dword dwBytesToRead, Dword* pvBytesRead, Dword dwOverlapped); OS_ERR WriteFile(void** hvFile, void* pvBuffer, Dword dwBytesToWrite, Dword* pvBytesWritten, Dword dwOverlapped); OS_ERR CloseFile(void** hvFile); Qword GetFileSize(void** hvFile); //--- kda (3/18/12) --- Provide the current path. OS_ERR GetCurrentDirectory(string* szFullPath); ////////////////////// //--Paint Handlers--// ////////////////////// OS_ERR BeginDraw(); OS_ERR EndDraw(); OS_ERR DrawMedia(CiMedia* pciMedia, INT iX, INT iY, INT iWidth, INT iHeight); OS_ERR DrawMedia(CiMedia* pvMedia); OS_ERR DrawRectangle(OSRect rc, Byte Red=255, Byte Blue=255, Byte Green=255); // OS_ERR TextOut(cstr pMessage){}; //**To Implement** OS_ERR MsgBox(cstr sMsg, cstr sCap); //OS_ERR MsgBox(CText txMsg, CText txCap); OS_ERR InvalidateDisplay(); OS_ERR UpdateDisplay(); OS_ERR CreateFontImageMap(PFONTMAP pfm, cstr sFntName="Arial", int nFntHeight=12, float fScale=1.0f, Dword dwImgHeight=256, Dword dwImgWidth=256, bool bBold=false, bool bItalic=false); // Class Handles. OS_ERR SetWindowState(int CmdShow); OS_ERR SetWindowHMenu(HMENU hmenu); OS_ERR SetHInstance(HINSTANCE hinst); OS_ERR SetWindowHIcon(HICON hicon); // Resource IDs. OS_ERR SetWindowIcon(Word wIconID); OS_ERR SetWindowMenu(Word wMenuID); // System Procedures. //long** WndProc(Word wMsg, Dword dwwParam, Dword dwlParam); Dword DefaultOSProc(Word wMsg, Dword dwwParam, Dword dwlParam); HWND GetHwnd(){return m_hwnd;} private: ////////////////////// //--Paint Handlers--// ////////////////////// // Derived -- Only exists in this OS OS_ERR MapBitmapToScreen(HDC hdc, PBitmap pbm, INT iX=0, INT iY=0, INT iWidth=0, INT iHeight=0); /////////////////////////// //--Creation Parameters--// /////////////////////////// OS_ERR TranslateError(DWORD dwErr); void RegClass(WNDPROC lpfnWndProc); };